package process0.ast;

import java.util.Vector;

import process0.visitor.Visitor;

public class Timeline implements Node {
	String id;
	Vector<Timeline> Timelines = new Vector<Timeline>();

	public Timeline(String id) {
		super();
		this.id = id;
	}

	public String getId() {
		return id;
	}

	public void setParentId(String id) {
		this.id = id + "." + this.id;
	}

	public Vector<Timeline> getTimeline() {
		return Timelines;
	}

	public void setTimeline(Vector<Timeline> timeline) {
		Timelines = timeline;
	}

	public void addTimeline(Timeline timeline) {
		Boolean b = true;
		for (Timeline t : Timelines) {
			if(t.getId() == timeline.getId())
			{
				b = false;
				System.out.println("[warn] ignor timelen with equal names ");
			}
		}
		if (b) {
//			timeline.setParentId(this.getId());
			Timelines.add(timeline);
		}
	}

	
	public void accept(Visitor visitor) {
		visitor.visit(this);
	}

}
